<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>用户列表</title>

    <!--data table-->
    {css href="/static/admin/js/data-tables/DT_bootstrap.css"}

    {css href="/static/admin/css/style.css"}
    {css href="/static/admin/css/style-responsive.css"}
    {css href="/static/admin/css/toastr.min.css"}



    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    {js href="/static/admin/js/html5shiv.js"}
    {js href="/static/admin/js/respond.min.js"}
    <![endif]-->
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <div class="logo">
            <a href="index.html"><img src="/static/admin/images/logo.png" alt=""></a>
        </div>

        <div class="logo-icon text-center">
            <a href="index.html"><img src="/static/admin/images/logo_icon.png" alt=""></a>
        </div>
        <!--logo and iconic logo end-->


        <div class="left-side-inner">

            <!-- visible to small devices only -->

            <!--sidebar nav start-->
            <ul class="nav nav-pills nav-stacked custom-nav">
                <li><a href="{:url('admin/index/show')}"><i class="fa fa-home"></i> <span>Dashboard</span></a></li>

                <li class="menu-list"><a><i class="fa fa-th-list"></i> <span>用户管理</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="{:url('admin/user/index')}"> 用户列表</a></li>
                        <li><a href="{:url('admin/user/create')}"> 用户添加</a></li>
                    </ul>
                </li>

                <li class="menu-list"><a><i class="fa fa-tasks"></i> <span>角色管理</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="{:url('admin/role/index')}">角色列表</a></li>
                        <li><a href="{:url('admin/role/create')}">角色添加</a></li>
                    </ul>
                </li>
                <li class="menu-list nav-active"><a><i class="fa fa-file-text"></i> <span>节点管理</span></a>
                    <ul class="sub-menu-list">
                        <li class="active"><a href="{:url('admin/access/index')}">节点列表</a></li>
                        <li><a href="{:url('admin/access/create')}">节点添加</a></li>
                    </ul>
                </li>


                <li class="menu-list"><a><i class="fa fa-th-list"></i> <span>作家申请</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="{:url('admin/Writer/writer_apply')}"> 申请列表</a></li>
                    </ul>
                </li>
                <li class="menu-list"><a><i class="fa fa-th-list"></i> <span>作家管理</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="{:url('admin/Writer/writer_user')}"> 作家列表</a></li>
                    </ul>
                </li>
                <li class="menu-list"><a><i class="fa fa-th-list"></i> <span>广告管理</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="{:url('admin/Guanggao/index')}"> 广告列表</a></li>
                        <li><a href="{:url('admin/Guanggao/add')}"> 广告添加</a></li>
                    </ul>
                </li>
                <li class="menu-list"><a href="#"><i class="fa fa-th-list"></i> <span>链接管理</span></a>
                    <ul class="sub-menu-list">
                        
                        <li><a href="{:url('admin/link/link')}"> 链接列表</a></li>
                    </ul>
                </li>
                <li class="menu-list"><a><i class="fa fa-file-text"></i> <span>Extra Pages</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="profile.html"> Profile</a></li>
                        <li><a href="invoice.html"> Invoice</a></li>
                        <li><a href="pricing_table.html"> Pricing Table</a></li>
                        <li><a href="timeline.html"> Timeline</a></li>
                        <li><a href="blog_list.html"> Blog List</a></li>
                        <li><a href="blog_details.html"> Blog Details</a></li>
                        <li><a href="directory.html"> Directory </a></li>
                        <li><a href="chat.html"> Chat </a></li>
                        <li><a href="404.html"> 404 Error</a></li>
                        <li><a href="500.html"> 500 Error</a></li>
                        <li><a href="registration.html"> Registration Page</a></li>
                        <li><a href="lock_screen.html"> Lockscreen </a></li>
                    </ul>
                </li>
                <li><a href="login.html"><i class="fa fa-sign-in"></i> <span>Login Page</span></a></li>

            </ul>
            <!--sidebar nav end-->

        </div>
    </div>
    <!-- left side end-->

    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <div class="header-section">

            <!--toggle button start-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->


            <!--notification menu start -->
            <div class="menu-right">
                <ul class="notification-menu">
                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <img src="/static/admin/images/photos/user-avatar.png" alt="" />
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-usermenu pull-right">
                            <li><a href="#"><i class="fa fa-user"></i>  Profile</a></li>
                            <li><a href="#"><i class="fa fa-cog"></i>  Settings</a></li>
                            <li><a href="#"><i class="fa fa-sign-out"></i> Log Out</a></li>
                        </ul>
                    </li>

                </ul>
            </div>
            <!--notification menu end -->

        </div>
        <!-- header section end-->

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                Editable Table
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Dashboard</a>
                </li>
                <li>
                    <a href="#">Data Table</a>
                </li>
                <li class="active"> Editable Table </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <header class="panel-heading">
                            作家申请列表
                            <span class="tools pull-right">
                        <a href="javascript:;" class="fa fa-chevron-down"></a>
                        <a href="javascript:;" class="fa fa-times"></a>
                     </span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table editable-table ">
                                <div class="clearfix">
                                    <div class="btn-group pull-right">
                                        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">Tools <i class="fa fa-angle-down"></i>
                                        </button>
                                        <ul class="dropdown-menu pull-right">
                                            <li><a onclick="window.print()">Print</a></li>
                                            <li><a onclick="window.print()">Save as PDF</a></li>
                                            <li><a onclick="window.print()">Export to Excel</a></li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="space15"></div>
                                <table class="table table-striped table-hover table-bordered" id="editable-sample">
                                    <thead>
                                    <tr>
                                        <th>广告ID</th>
                                        <th>广告图片</th>
                                        <th>广告名称</th>
                                        <th>广告网址</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="data" id="v"}
                                    <tr>
                                        <td>{$v['id']}</td>
                                        <td style="height:50px"><img src="/guanggao/{$v['gg_img']}" width="50px" height="50px"></td>
                                        <td>{$v['gg_name']}</td>
                                        <td>{$v['gg_url']}</td>
                                        <td>
                                            <button class="btn btn-danger btn-xs del-btn" data-id="{$v['id']}" type="btn">&nbsp;删除&nbsp;</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="{:url('admin/Guanggao/edit',['id'=>$v['id']])}"> 修改&nbsp;&nbsp;&nbsp;</a>
                                                {if condition=" $v['gg_status'] eq 1"}
                                                 <a href="{:url('admin/Guanggao/gg_change',['id'=>$v['id']])}">展示中... &nbsp;&nbsp;&nbsp;</a>
                                                {else /}
                                                <a href="{:url('admin/Guanggao/gg_change',['id'=>$v['id']])}">暂不展示...&nbsp;&nbsp;&nbsp;</a>
                                            {/if}

                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->

        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
{js href="/static/admin/js/jquery-1.10.2.min.js"}
{js href="/static/admin/js/jquery-ui-1.9.2.custom.min.js"}
{js href="/static/admin/js/jquery-migrate-1.2.1.min.js"}
{js href="/static/admin/js/bootstrap.min.js"}
{js href="/static/admin/js/modernizr.min.js"}
{js href="/static/admin/js/jquery.nicescroll.js"}
{js href="/static/admin/js/toastr.min.js"}


<!--data table-->
{js href="/static/admin/js/data-tables/jquery.dataTables.js"}
{js href="/static/admin/js/data-tables/DT_bootstrap.js"}


<!--common scripts for all pages-->
{js href="/static/admin/js/scripts.js"}

<!--script for editable table-->
{js href="/static/admin/js/editable-table.js"}

<!-- END JAVASCRIPTS -->
<script>
    jQuery(document).ready(function() {
        EditableTable.init();
    });
</script>

<script>

    $(function(){

        // 设置弹框参数
        toastr.options = {
            closeButton: true,// 是否显示关闭按钮
            progressBar: true,// 实现显示计时条
            timeOut: "3000",  // 自动关闭时间
            positionClass: "toast-top-right" // 提示位置
            // toast-top-full-width 顶端，宽度铺满整个屏幕
            // toast-top-right  顶端右边
            // toast-bottom-left
        };

        //删除
        $('.del-btn').click(function(){
            var ac_id = $(this).attr('data-id');
            console.log('删除操作,ID:', ac_id);
            if (confirm('你确定要[删除]吗?!')) {
                var obj = $(this).parents('tr');
                delAjax(ac_id, obj); // 执行AJAX删除
            }
        });

        // 执行AJAX删除
        function delAjax(id, obj) {
            // console.log(obj);
            $.ajax({
                type: 'delete',
                url: '/guanggaos/' + id,
                dataType: 'json',
                success: function (data) {
                    console.log(data);
                    if (data.status) {
                        toastr.success(data.info);
                        // 将该条目删除掉
                        obj.remove();
                    } else {
                        toastr.error(data.info, 'FBI WARING:');
                    }
                },
                error: function () {
                    alert('AJAX操作失败');
                }
            });
        }


    });




</script>

</body>
</html>
